package com.ruixi.spring.proxy;

public class Test {

	public static void main(String[] args) {
		//调用动态代理
		ProxyUtil proxyUtil = new ProxyUtil(new MathImpl());

		//向下转型 注意转化为的是共同实现的接口,而不是目标对象
		MathI math = (MathI)proxyUtil.getProxy();
		int result = math.add(1, 1);
		System.out.println(result);

		System.out.println("***********");

		//模拟抛出异常
//		result = math.div(4, 0);
		System.out.println(result);

		result = math.div(4, 1);


	}

}
